#ifndef FILEMANAGE_H
#define FILEMANAGE_H

#include<QMutex>
#include<QMutexLocker>
#include <QStringList>
#include<QDir>

#include"experiment.h"
#include"tunemanual.h"
#include"analytedatabase.h"

#define FM FileManage::GetInstance()

class FileManage
{
public:
    static FileManage *GetInstance()
    {
       if(!instance)
        {
            if(!instance)
            {
                instance=new FileManage;
            }
       }
       return instance;
    }

   int SaveToFile(QString fileName,Experiment *);
   int LoadFromFile(QString fileName,Experiment *);
   int SaveToFile(QString fileName,AnalyteDataBase *);
   int LoadFromFile(QString fileName,AnalyteDataBase *);
   int SaveToFile(QString fileName,TuneResult *);
   int LoadFromFile(QString fileName,TuneResult *);
   int SaveToFile(QString fileName,CalRatio *);
   int LoadFromFile(QString fileName,CalRatio *);
   int SaveToFile(QString fileName,QStringList *);//QStringList queueExp
   int LoadFromFile(QString fileName,QStringList *);
   int SaveToFile(QString fileName,TuneManual *);
   int LoadFromFile(QString fileName,TuneManual *);
   int SaveToFile(QString fileName,WorkFlow *);
   int LoadFromFile(QString fileName,WorkFlow *);

   static QString GetExpsDir();
   static QString GetDataBaseDir();
   static QString GetTuneManualDir();
   static QString GetSysDataDir();

   static QString GetExpsSuffix();
   static QString GetDataBaseSuffix();
   static QString GetTuneManualSuffix();
   static QString GetSysDataSuffix();

   static QString GetTuneFile();
   static QString GetMassCalStdFile();
   static QString GetMassCalHtdFile();
   static QString GetCrossCalFile();
   static QString GetQueueFile();
   static QString GetTuneManualParaFile();
   static QString GetAnalyteDataBaseFile();
   static QString GetWorkFlowFile();

private:
   FileManage();

    static QStringList fileNames;//filePath
    static QStringList dirNames;// dirPath
    static QStringList fileSuffixs;

    static QMutex mutex;
    static FileManage* instance;
};

#endif // FILEMANAGE_H
